"""
这是添加合同页面类
"""
#引入基类
from framwork.pages.base_page import BasePage
#引入by方法
from selenium.webdriver.common.by import By

class AddContractPage(BasePage):
    """先写定位器，再写方法"""
    source_sj_locator = (By.NAME, "business_name")  # 来源商机定位
    choose_btn_locator = (By.NAME, "business")
    ok_btn_locator = (By.XPATH, "//span[text()='Ok']")
    save_btn_locator = (By.CSS_SELECTOR, "input.btn.btn-primary")
    ht_price_locator = (By.ID, "price")

    def input_ht_price(self, ht_price):
        self.find_element(self.ht_price_locator).send_keys(ht_price)

    def click_source_sj(self):
        """点击来源商机"""
        self.find_element(self.source_sj_locator).click()

    def choose_sj(self):
        """选择商机"""
        self.find_element(self.choose_btn_locator).click()

    def click_ok(self):
        """点击ok"""
        self.find_element(self.ok_btn_locator).click()

    def click_save(self):
        '''点击保存'''
        self.find_element(self.save_btn_locator).click()
